package com.yc.spring;

import com.yc.spring.mapper.UserMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
//组件扫描，扫描指定的包及其子包
//不仅扫描到了该包的注解，还扫描到了该包的配置AnnoConfig
@ComponentScan("com.yc.spring")
public class AutoWriteAnnoConfig {
    @Bean("myUserMapper")
    public UserMapper userMapper(){
        UserMapper userMapper = new UserMapper();
        userMapper.setMyName("李四");
        return userMapper;
    }
}
